<template>
    <div id="dialog-container">
        <el-dialog v-dialogDrag 
            title="计量器具状态变更单" append-to-body
            :visible.sync="dialogVisible" @close="$emit('update:show', false)" :before-close="handleClose" :show="show"
            :close-on-click-modal="false" width="700px">
            <el-form :model="form" :inline="true" size="small" label-width="100px">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="任务类型：">
                            <el-input size="" v-model="form.sort" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="申请人：">
                            <el-input size="" v-model="form.name" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="申请单位：">
                            <el-input size="" v-model="form.name" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="申请日期：">
                            <el-input size="" v-model="form.name" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="变更部门：">
                            <el-select v-model="form.optionVal" placeholder="请选择" style="width: 200px;" :disabled="true">
                                <el-option v-for="item in form.options"
                                    :key="item.value" :label="item.label" :value="item.value"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="变更状态：">
                            <el-select v-model="form.statusVal" placeholder="请选择" style="width: 100px;">
                                <el-option v-for="item in form.status"
                                    :key="item.value" :label="item.label" :value="item.value"></el-option>
                            </el-select>
                            <el-checkbox-group v-model="form.checkList" style="display: inline-block;margin-left: 1px;">
                                <el-checkbox label="内部"></el-checkbox>
                                <el-checkbox label="外部" style="margin-left: 10px;"></el-checkbox>
                            </el-checkbox-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col>
                        <el-form-item label="备注：">
                            <el-input type="textarea" :rows="2" placeholder="备注" v-model="form.name" style="width: 530px"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <hr>
            <el-row style="margin-bottom: 10px;">
                <el-col :span="4">
                    <el-button type="primary" size="small" @click="addChange">添加待变更</el-button>
                </el-col>
                <el-col :span="2">
                    <el-button size="small" type="danger">批量删除</el-button>
                </el-col>
            </el-row>
            <!-- 添加待检测弹框 -->
            <add-wait-change :show.sync="showChange"></add-wait-change>
            <el-table :data="tableData" border stripe size="mini">
                <el-table-column type="selection" width="50" align="center" :resizable="false"></el-table-column>
                <el-table-column type="index" label="序号" width="50" align="center" :resizable="false"></el-table-column>
                <el-table-column prop="status" label="现有状态" min-width="80" :resizable="false"></el-table-column>
                <el-table-column prop="" label="变更状态" min-width="90" :resizable="false"></el-table-column>
                <el-table-column prop="" label="器具名称" min-width="100" :resizable="false"></el-table-column>
                <el-table-column prop="" label="现用部门" min-width="100" :resizable="false"></el-table-column>
                <el-table-column prop="" label="变更部门" min-width="80" :resizable="false"></el-table-column>
                <el-table-column prop="" label="分类代码" min-width="80" :resizable="false"></el-table-column>
                <el-table-column prop="" label="统一编号" min-width="80" :resizable="false"></el-table-column>
                <el-table-column prop="" label="型号" min-width="90" :resizable="false"></el-table-column>
                <el-table-column prop="" label="申请人" min-width="90" :resizable="false"></el-table-column>
                <el-table-column prop="" label="申请单位" min-width="100" :resizable="false"></el-table-column>
                <el-table-column prop="" label="申请日期" min-width="100" :resizable="false"></el-table-column>
                <el-table-column prop="" label="操作" fixed="right" width="60">
                    <template slot-scope="scope">
                        <el-button type="danger" icon="el-icon-delete" size="mini"></el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
                <el-button @click="dialogVisible = false">取 消</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
    import AddWaitChange from 'dialog/test-manage/tool-status-change/add-wait-change';
    export default {
        components: {
            'add-wait-change': AddWaitChange
        },
        data() {
            return {
                dialogVisible: this.show,
                form: {
                    sort: '新计量器具验收',
                    name: '',
                    options: [],
                    optionVal: '',
                    status: [{
                            value: '在用',
                            label: '在用'
                        },{
                            value: '停用',
                            label: '停用'
                        },{
                            value: '闲置',
                            label: '闲置'
                        },{
                            value: '禁用',
                            label: '禁用'
                        },{
                            value: '备用',
                            label: '备用'
                        },{
                            value: '报废',
                            label: '报废'
                        },{
                            value: '遗失',
                            label: '遗失'
                        },{
                            value: '转移',
                            label: '转移'
                        }],
                    statusVal: ''
                },
                tableData: [{
                        status: '待提交'
                    }],
                showChange: false
            }
        },
        props: {
            show: {
                type: Boolean,
                default: false
            }
        },
        watch: {
            show() {
                this.dialogVisible = this.show;
            }
        },
        methods: {
            handleClose() {
                this.dialogVisible = false;
            },
            // 弹框： 添加变更计量器具
            addChange(){
                this.showChange = true;
            }
        }
    }
</script>
